package com.example.hhh.service.impl;

import com.example.hhh.model.OrderNote;
import com.example.hhh.repository.OrderNoteRepository;
import com.example.hhh.service.OrderNoteService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;

@Service
public class OrderNoteServiceImpl implements OrderNoteService {

    private final OrderNoteRepository orderNoteRepository;

    @Autowired
    public OrderNoteServiceImpl(OrderNoteRepository orderNoteRepository) {
        this.orderNoteRepository = orderNoteRepository;
    }

    @Override
    public OrderNote createNote(OrderNote note) {
        return orderNoteRepository.save(note);
    }

    @Override
    public List<OrderNote> getNotesByOrder(Integer orderId) {
        return orderNoteRepository.findByOrderId(orderId);
    }
}